Socket
Socket
Sign inDemoInstall

@aws-cdk/aws-iam

Package Overview
Dependencies
2
Maintainers
5
Versions
288
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-cdk/aws-iam


Version published
Weekly downloads
156K
increased by7.42%
Maintainers
5
Created
Weekly downloads
 

Changelog

Source

0.29.0 (2019-04-24)

Bug Fixes

  • acm: enabled validation of certificates on the zone name (#2133) (f216f96)
  • aws-apigateway: add integrationHttpMethod prop to AwsIntegration (#2160) (dfc6665), closes #2105
  • aws-cloudwatch: remove workaround on optional DashboardName (6c73d8a), closes #213
  • aws-ecs: fix default daemon deploymentConfig values (#2210) (c2e806b), closes #2209
  • aws-ecs: handle long ARN formats for services (#2176) (66df1c8), closes #1849
  • aws-lambda: fix circular dependency with lambda and codedeploy (#2236) (382da6a)
  • certificatemanager: remove bundled lambda devdependencies (#2186) (6728b41)
  • codebuild: add validation for Source when the badge property is true (#2242) (07812b2), closes #1749
  • core: allow CfnMapping.findInMap to use pseudo functions/params (#2220) (464cb6f), closes #1363
  • core: Use different symbol for Stack.isStack versus CfnReference.isCfnReference (#2305) (c1e41ed)
  • decdk: set the timeout in the schema tests to 10 seconds. (#2250) (8521b6f)
  • dynamodb: remove global secondary index limit (#2301) (43afa3a), closes #2262
  • ecr: Fix typo in ImportRepository error message (#2217) (b7c9b21)
  • elasticloadbalancingv2: dependency between ALB and logging bucket (#2221) (99e085d), closes #1633
  • java-app-template: invoke app.run() (#2300) (47ff448), closes #2289 awslabs/jsii#456
  • lambda: avoid OperationAbortedException when using log retention (#2237) (12a118c)
  • s3: Add validations for S3 bucket names (#2256) (f810265), closes #1308
  • servicediscovery: allow to register multiple instances on a service (#2207) (9f88696)
  • toolkit: don't fail when terminal width is 0 (#2355) (9c2220c), closes #2253
  • toolkit: fix broken confirmation prompt (#2333) (4112c84)
  • toolkit: options requiring arguments fail if not supplied (#2197) (0f6ce56), closes #2192
  • toolkit: remove metadata warning if region does not have resource (#2216) (22ed67c)
  • toolkit: stop 'cdk doctor' from printing AWS_ variables (#2357) (6209c6b), closes #1931
  • codebuild: remove oauthToken property from source (#2252) (8705af3), closes #2252 #2199
  • aws-ec2: correct InstanceSize.Nano spelling (#2215) (d22a154), closes #2215 #2214

Features

  • aws-dynamodb-global: global dynamodb tables (experimental) (#2251) (ec367c8)
  • aws-events-targets: centralized module for cloudwatch event targets (#2343) (1069938)
  • cdk-dasm: generate cdk code from cloudformation (#2244) (b707782)
  • cloudwatch: add support for time ranges in dashboards (#2248) (18c1723)
  • codebuild: add support for more images (#2233) (87b1ea0), closes #2079
  • codepipeline: add ECS deploy Action. (#2050) (d46b814), closes #1386
  • codepipeline: change to stand-alone Artifacts. (#2338) (b778e10)
  • codepipeline: make the default CodePipeline Bucket have an encryption key (#2241) (ef9bba5), closes #1924
  • core: verify CfnOutput has a value and fix VPC export (#2219) (9e87661), closes #2012
  • events-targets: LambdaFunction (#2350) (48d536b), closes #1663
  • ec2: add support for vpc endpoints (#2104) (bbb3f34)
  • lambda: introduce a new kind of Code, CfnParametersCode. (#2027) (4247966)
  • cfnspec: update CloudFormation resources to v2.30.0 (#2239) (aebcde5)
  • toolkit: stage assets under .cdk.assets (#2182) (2f74eb4), closes #1716 #2096

BREAKING CHANGES TO EXPERIMENTAL FEATURES

  • cloudwatch: Renamed MetricCustomization to MetricOptions.
  • codepipeline: CodePipeline Actions no longer have the outputArtifact and outputArtifacts properties.
  • codepipeline: inputArtifact(s) and additionalInputArtifacts properties were renamed to input(s) and extraInputs.
  • codepipeline: outputArtifactName(s) and additionalOutputArtifactNames properties were renamed to output(s) and extraOutputs.
  • codepipeline: The classes CodeBuildBuildAction and CodeBuildTestAction were merged into one class CodeBuildAction.
  • codepipeline: The classes JenkinsBuildAction and JenkinsTestAction were merged into one class JenkinsAction.
  • events-targets: lambda.Function no longer implements IEventRuleTarget. Instead, use @aws-cdk/aws-events-targets.LambdaFunction.
  • aws-events-targets: sns.Topic no longer implements IEventRuleTarget. Use @aws-cdk/aws-events-targets.SnsTopic instead.
  • codebuild: codebuild.Project no longer implements IEventRuleTarget. Use @aws-cdk/aws-events-targets.CodeBuildProject.
  • core: the cdk.Root construct has been removed. Use cdk.App instead.
  • stepfunctions: In stepfunctions.WaitProps: the props seconds, timestamp, secondsPath and timestampPath are now duration of a union-like class WaitDuration (e.g. duration: WaitDuration.seconds(n))
  • codedeploy: In codedeploy.ServerDeploymentConfigProps: the props minHealthyHostCount and minHealthyHostPercentage are now minimumHealthyHosts of union-like class MinimumHealthyHosts (e.g. minimumHealthyHosts: MinimumHealthyHosts.percentage(50))
  • cloudformation: In cloudformation.CustomResourceProps: the props topicProvider and lambdaProvider are now provider of union-like class CustomResourceProvider (e.g. CustomResourceProvider.lambda(fn)
  • cloudformation: cloudformation.CustomResource no longer extends CfnCustomResource.
  • ssm: ssm.ParameterProps renamed to ssm.ParameterOptions.
  • codepipeline: customers who use GitHub, GitHubEnterprise or Bitbucket as source will need to remove the oauthToken field as it's no longer available.
  • codebuild: change the default image from UBUNTU_14_04_BASE to UBUNTU_18_04_STANDARD.
  • ec2: aws-ec2.InstanceSize.None was renamed to InstanceSize.Nano
  • ec2: * vpc.selectSubnetIds(...) has been replaced with vpc.selectSubnets(...).subnetIds.
  • You will not be able to combine jsii libraries written against previous versions of jsii with this version of the CDK.

Readme

Source

AWS IAM Construct Library

Define a role and add permissions to it. This will automatically create and attach an IAM policy to the role:

attaching permissions to role

Define a policy and attach it to groups, users and roles. Note that it is possible to attach the policy either by calling xxx.attachInlinePolicy(policy) or policy.attachToXxx(xxx).

attaching policies to user and group

Managed policies can be attached using xxx.attachManagedPolicy(arn):

attaching managed policies

Configuring an ExternalId

If you need to create roles that will be assumed by 3rd parties, it is generally a good idea to require an ExternalId to assume them. Configuring an ExternalId works like this:

supplying an external ID

Principals vs Identities

When we say Principal, we mean an entity you grant permissions to. This entity can be an AWS Service, a Role, or something more abstract such as "all users in this account" or even "all users in this organization". An Identity is an IAM representing a single IAM entity that can have a policy attached, one of Role, User, or Group.

IAM Principals

When defining policy statements as part of an AssumeRole policy or as part of a resource policy, statements would usually refer to a specific IAM principal under Principal.

IAM principals are modeled as classes that derive from the iam.PolicyPrincipal abstract class. Principal objects include principal type (string) and value (array of string), optional set of conditions and the action that this principal requires when it is used in an assume role policy document.

To add a principal to a policy statement you can either use the abstract statement.addPrincipal, one of the concrete addXxxPrincipal methods:

  • addAwsPrincipal, addArnPrincipal or new ArnPrincipal(arn) for { "AWS": arn }
  • addAwsAccountPrincipal or new AccountPrincipal(accountId) for { "AWS": account-arn }
  • addServicePrincipal or new ServicePrincipal(service) for { "Service": service }
  • addAccountRootPrincipal or new AccountRootPrincipal() for { "AWS": { "Ref: "AWS::AccountId" } }
  • addCanonicalUserPrincipal or new CanonicalUserPrincipal(id) for { "CanonicalUser": id }
  • addFederatedPrincipal or new FederatedPrincipal(federated, conditions, assumeAction) for { "Federated": arn } and a set of optional conditions and the assume role action to use.
  • addAnyPrincipal or new AnyPrincipal for { "AWS": "*" }

If multiple principals are added to the policy statement, they will be merged together:

const statement = new PolicyStatement();
statement.addServicePrincipal('cloudwatch.amazonaws.com');
statement.addServicePrincipal('ec2.amazonaws.com');
statement.addAwsPrincipal('arn:aws:boom:boom');

Will result in:

{
  "Principal": {
    "Service": [ "cloudwatch.amazonaws.com", "ec2.amazonaws.com" ],
    "AWS": "arn:aws:boom:boom"
  }
}

The CompositePrincipal class can also be used to define complex principals, for example:

const role = new iam.Role(this, 'MyRole', {
  assumedBy: new iam.CompositePrincipal(
    new iam.ServicePrincipal('ec2.amazonawas.com'),
    new iam.AccountPrincipal('1818188181818187272')
  )
});

Features

  • Policy name uniqueness is enforced. If two policies by the same name are attached to the same principal, the attachment will fail.
  • Policy names are not required - the CDK logical ID will be used and ensured to be unique.

Keywords

FAQs

Last updated on 24 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc